//
//  HDCFMycolcCell.m
//  HaoDeCaiFu
//
//  Created by 郑开宏 on 2017/11/2.
//  Copyright © 2017年 郑开宏. All rights reserved.
//

#import "HDCFMycolcCell.h"

@interface HDCFMycolcCell ()
@property (weak, nonatomic) IBOutlet UILabel *fundName;
@property (weak, nonatomic) IBOutlet UILabel *fundCode;
@property (weak, nonatomic) IBOutlet UILabel *clearMoney;
@property (weak, nonatomic) IBOutlet UILabel *dayAdd;
@property (weak, nonatomic) IBOutlet UILabel *forrverAdd;

@end

@implementation HDCFMycolcCell

- (void)setDataDict:(NSDictionary *)dataDict{
    _dataDict = dataDict;
    _fundName.text = dataDict[@"fundName"]?dataDict[@"fundName"]:@"";
    _fundCode.text = [NSString stringWithFormat:@"|  %@", dataDict[@"fundCode"]? dataDict[@"fundCode"]:@""];
    
    NSNumber *nav = dataDict[@"nav"];
    if ([nav isKindOfClass:[NSNull class]]) {
        _clearMoney.text = [NSString stringWithFormat:@"0.0000"];
    }
    else
    {
        _clearMoney.text = [NSString stringWithFormat:@"%.4f", nav.doubleValue];
    }
    
    
    NSNumber *day1Performance = dataDict[@"day1Performance"];
    if ([day1Performance isKindOfClass:[NSNull class]]) {
        _dayAdd.text = [NSString stringWithFormat:@"0.00%%"];
    }
    else
    {
        _dayAdd.text = [NSString stringWithFormat:@"%.2f%%", day1Performance.doubleValue];
    }
    
    NSNumber *sinceLaunch = dataDict[@"sinceLaunch"];
    double ye = sinceLaunch.doubleValue;
    double yet = ye * 100;
    if ([sinceLaunch isKindOfClass:[NSNull class]]) {
        _forrverAdd.text = [NSString stringWithFormat:@"0.00%%"];
    }
    else
    {
        _forrverAdd.text = [NSString stringWithFormat:@"%.2f%%", yet];
    }
}

+ (instancetype)HDCFMycolcCell{
    return [[NSBundle mainBundle] loadNibNamed:@"HDCFMycolcCell" owner:nil options:nil].firstObject;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
